#ifndef __TYPES__H
#define __TYPES__H
#include <vector>
#include <string>
#include <cstring>

#define READ 0x1
#define WRITE 0X2
#define OWN 0x4

#define NONE    "\033[m"
#define RED     "\033[0;32;31m"
#define CYAN    "\033[0;36m"

struct file
{
    std::string filename;
    std::string creator;
    std::string content;
};
struct user
{
    std::string name;
    std::string password;
};
struct SOA
{
    std::string user;
    std::string filename;
    int access;
    std::string from_to;
};
typedef struct file file;
typedef struct user user;
typedef struct SOA SOA;

class current_user
{
private:
    int level = 0;  // root(0) or normal(1)
    int flag = 0;   // central(0) or distributed(1)
    user u;
public:
    current_user() {};
    current_user(int level, int flag, user u);
    ~current_user();
    std::string get_username();
    int create_subject(std::string &name, std::string &password);
    int delete_subject(std::string &username);
    int create_object(std::string &filename, std::string &content);
    int read_object(std::string &filename);
    int write_object(std::string &filename, std::string c);
    int delete_object(std::string &filename);
    int transfer_right(int access, std::string &user_to, std::string &filename);
    int revoke_right(int access, std::string &user, std::string &filename);
};


#endif




